import requests
from lxml import e tree



url = 'http://book.zongheng.com/store.html'

response = requests.get(url)

print(response.status_code)

html = response.text
ehtml = etree.HTML(html)

title = ehtml.xpath('//div[@class="bookname"]/a/text()')
author = ehtml.xpath('//div[@class="bookilnk"]/a/text()')
print(title)
print(author)
#.txt  .csv 
# import csv
# with open("test.csv","a+",newline='') as f:
#     w = csv.writer(f)
#     for i,j in zip(title,author):
#         w.writerow([i,j])

    # f.writelines([i +' '+j+'\n for i in title])
import sqlite3
dbname = 'test.db'

conn = sqlite3.connect(dbname)

c = conn.cursor()

insterData = '''
                INSERT INTO novelTest VALUES(?,?)
       '''
c.execute(insertDate,("西游记","吴承恩"))    


c.execute(sql)

conn.commit()
conn.close()